package com.homedo.core.common.base.dto;

import lombok.Data;

/**
 * @author Harvey
 * @title: ResultData
 * @package com.homedo.core.common.base.dto
 * @date 2018/1/19 13:57
 */

@Data
public class ResultData {
    private int code;
    private String msg;
    private Object data;

    public ResultData() {

    }

    public ResultData(Meta meta, Object data) {
        this.code = meta.getCode();
        this.msg = meta.getMsg();
        this.data = data;

    }

    public ResultData(Meta meta) {
        this.code = meta.getCode();
        this.msg = meta.getMsg();
    }

    public static ResultData newInstance() {
        return new ResultData(Meta.CODE_200);
    }

    public static ResultData newInstance(Object data) {
        return ResultData.newInstance(Meta.CODE_200, data);
    }
    public static ResultData newInstance(Meta meta, Object data) {
        return new ResultData(meta, data);
    }
}
